package array;

public class Test01 {

	public static void main(String[] args) {
		/*
		 * 声明并初始化数组
		 * */
		int[] array=new int[] {1,2,3,4,5,6,7,8,9};
		/*
		 * 用for循环
		 * */
		for(int x=0;x<array.length;x++) {
			if(x==array.length-1) {
			System.out.print(array[x]+"]");
			continue;
			}if(x==0) {
				System.out.print("["+array[x]+",");
				continue;
			}
			System.out.print(array[x]+",");
			}
		System.out.println();
		//增强for对其遍历
		for(int i : array) {
			System.out.print(" "+i);
		}

	}

}
